package fr.dsax.nounet.belote.jpa;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

/**
 * Entity implementation class for Entity: Team
 *
 */
@Entity
public class Team extends GenericEntity {

	@OneToMany(cascade=CascadeType.ALL)
	private List<Player> players;
	
	private String name;
	
	private static final long serialVersionUID = 1L;

	public Team() {
		super();
	}  
	
	public List<Player> getPlayers() {
		return this.players;
	}

	public void setPlayers(List<Player> players) {
		this.players = players;
	}
	
	public void setPlayers(Player ... players) {
		if(this.players == null) {
			this.players = new ArrayList<Player>();
		}
		for (Player player : players) {
			this.players.add(player);
		}
	}
	
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}
   
}
